package com.cskaoyan.controller;

import com.cskaoyan.bean.Brand;
import com.cskaoyan.bean.Storage;
import com.cskaoyan.bo.BrandBO;
import com.cskaoyan.service.BrandService;
import com.cskaoyan.vo.BaseRespVo;
import com.cskaoyan.vo.BrandVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class BrandController {

    @Autowired
    BrandService brandService;

    @RequestMapping("admin/brand/list")
    public BaseRespVo brand(Integer page, Integer limit, Integer id, String name, String sort , String order){

         BrandVO brandVO=brandService.queryBrand(page,limit,id,name,sort,order);

        return BaseRespVo.ok(brandVO);
    }
    @RequestMapping("admin/brand/delete")
    public BaseRespVo brandDelete(@RequestBody BrandBO brandBO){
        brandService.brandDelete(brandBO);
        return BaseRespVo.ok();
    }
  /*  @RequestMapping("admin/storage/create")
    public BaseRespVo storageUpload(MultipartFile file){
        Storage storage=brandService.storageUpload(file);
        return BaseRespVo.ok(storage);
    }*/
    @RequestMapping("admin/brand/create")
    public BaseRespVo brandCreate(@RequestBody Brand brand){
        Brand brands =brandService.brandCreate(brand);
        return BaseRespVo.ok(brand);
    }
    @RequestMapping ("admin/brand/update")
    public BaseRespVo brandUpdate(@RequestBody Brand brand){
        Brand brands = brandService. brandUpdate(brand);
        return BaseRespVo.ok(brands);
    }



}
